import { CodeTableStatus } from '@/enums/statusEnum';
// 规定返回数据格式
// 码表
export interface DataItem {
  id?: number;
  stopwatchCode: string; //码表编号
  stopwatchName: string; //码表名称
  stopwatchIllustrate: string; //码表说明
  stopwatchStatus: number | string; //码表状态
  createTime?: string;
  updateTime: string; //码表更新时间
  statusColor?: string; //码表状态颜色
}
// 数据标准
export interface DataStandard {
  id?: number;
  dcChName: string; //中文名称
  dcEnName: string; //英文名称
  dcCode: string; //标准编号
  dcDataType: number | string; //数据类型
  dcStatus: number | string; //标准状态
  dcSourceStructure: string; //来源机构
  dcExplain: string; //标准数据说明
  createTime?: string; //
  updateTime: string; //码表更新时间
  statusColor?: string; //状态颜色
}
// 批量传递规定格式
export type info = {
  status: 1 | 2;
  data: [];
};
//码值规范
export type stopwatchConfig = {
  id: number;
  encodingValue: string;
  encodingName: string;
  encodingMeaning: string;
};

export type Key = string | number;
// 码表请求格式
export type postData = {
  pageNum: number;
  pageSize: number;
  stopwatchName?: string;
  stopwatchStatus?: number;
};
// 新增--修改请求格式
export type insertStopwatchType = {
  stopwatchName: string;
  stopwatchIllustrate?: string;
  configList?: unknown;
  stopwatchCode?: string;
};
// 修改状态请求格式
export type operationStatus = {
  status: CodeTableStatus;
  codeList: [string];
};
// 批量分类
export type batchClassify = {
  apiCodeList: [string];
  directoryCode: string;
};
//
// export type DrawersConfig = {
//   handStopwatchName: string;
//   handStopwatchIllustrate: string;
//   handStopwatchCode: string;
//   stopwatchConfig: [];
//   pageNum: number;
//   pageSize: number;
// };
// 树结构请求格式
export type postTree = {
  directoryCode: string;
  directoryName: string;
  menuCode: string;
  parentCode: string;
  status?: string;
};

//数据标准详情、新增、编辑配置
export type dataCriterionStandard = {
  dcCode: string; //标准编号
  dcChName: string; //中文名称
  dcEnName: string; //英文名称
  dcExplain: string; //标准说明
  dcSourceStructure: string; //来源机构
  dcDataLength: number | string; //数据长度
  dcDataType: string | number; //数据类型
  dcMaxValue: number | string; //最大值
  dcMinValue: number | string; //最小值
  dcValue: string; //默认值
  dcDataNull: number | undefined | string; //是否为空
  dcDataPrecision: number | string; //数据精度
  stopwatchName: string; //枚举范围
  status?: string; //判断是新增还是修改操作
};
// 数据库管理请求格式
export type postDataBase = {
  dsmName: string;
  dsmStatus: number | undefined;
  pageNum: number;
  pageSize: number;
  total: number;
};
// 数据库管理接收格式
export type handDataBase = {
  createTime: string;
  dsmConnectInfo: string;
  dsmDescribe: string;
  dsmDriverName: string;
  dsmName: string;
  dsmPassword: string;
  dsmStatus: number | string;
  dsmUsername: string;
  dtName: string;
  id: number;
  updateTime: string;
  statusColor?: string; //码表状态颜色
};
//新增数据源、数据库编辑
export type addingDataSources = {
  dtCode: string | undefined; //数据库类型
  dsmName: string; //数据源名称
  dsmDescribe: string; //数据源描述
  dsmConnectInfo: string; //JDBC URL
  dsmDriverName: string; //驱动类名
  dsmUsername: string; //用户名
  dsmPassword: string; //密码
  status: number; //判断是新增还是编辑
};

// 连通测试传递数据
export type connectTestType = {
  dsmConnectInfo: string;
  dsmName: string;
  dsmDriverName?: string;
  dsmUsername?: string;
  demPassword?: string;
};

//数据资产表字段添加
export type daFieldDTOMessage = {
  key: string;
  dafEnName: string; //字段英文名称
  dafChName: string; //字段中文名称
  dafExplain: string; //字段说明
  dcCode: string; //标准映射
  dcDataType: string | number; //数据类型
  dcDataLength?: number; //数据长度
  dcDataPrecision?: number; //数据精度
  dcValue?: number; //默认值
  dcMaxValue?: number; //最大值
  dcMinValue?: number; //最小值
  stopwatchName?: string; //枚举范围
  dcvalueRange?: string; //取值范围
};

//新增数据资产管理
export type dataAssert = {
  daChName: string; //中文名称
  daCode: string;
  daDescribe: string; //数据资产明细
  daEnName: string; //英文名称
  directoryNameList: string[]; //所属目录
  daFieldDTO: daFieldDTOMessage[];
};

// 数据资产目录请求格式
export type dapostData = {
  pageNum: number;
  pageSize: number;
  daStatus?: string;
  daChName?: string;
  daEnName?: string;
  directoryCode?: string;
};
// 返回数据资产目录请求格式
export interface daDataItem {
  id?: number;
  daCode: string; //编号
  daChName: string; //中文名称
  daEnName: string; //英文名称
  daDescribe: string; //英文名称
  daStatus: number | string; //状态
  createTime?: string;
  updateTime: string; //更新时间
  statusColor?: string; //状态颜色
}
// 接口管理请求参数
export type interfaceType = {
  apiName: string;
  apiSource: string;
  apiStatus: string;
  directoryCode: string;
  pageNum: number;
  pageSize: number;
  total: number;
};
// 接管理列表返回值
export type returnInterfaceType = {
  apiDescribe: string;
  apiName: string;
  apiSource: string;
  apiStatus: number | string;
  directoryName: string;
  id: number;
  updateTime: string;
  statusColor?: string; //状态颜色
};
/* //新增接口
export type addingApi = {
  apiAgreement: string;
  apiDescribe: string;
  apiDirectoryCode: string;
  apiIpPort: string;
  apiName: string;
  apiPath: string;
  apiRequestMethod: string;
  apiRequestTimeout: string;
  apiSource: string;
  apiCode: string;
  apiStatus: 0;
  createOrUpdateApiParamterConfigurationList: addingApiParamterConfig[];
}; */
//新增接口参数配置
export type addingApiParamterConfig = {
  apcName: string;
  apcPosition?: string | number;
  apcDataType: string | number;
  apcDataNull?: string | number;
  apcValue?: string;
  apcDescription: string;
  apcParentParamCode?: string;
  apcCode: string;
  apiCode?: string;
  children?: addingApiParamterConfig[];
  parent?: addingApiParamterConfig;
  apcNameVerify?: {
    message: string;
    status: string;
  };
  apcDataTypeVerify?: object;
  apcDataNullVerify?: object;
  apcPositionVerify?: object;
};

// 接口详情返回参数--新增编辑公用
export type apiDetailType = {
  apiAgreement: string | number; //请求协议
  apiDescribe: string; //描述
  apiDirectoryCode: string; //所属目录
  apiIpPort: string; //端口号
  apiName: string; //接口名称
  apiPath: string; //接口路径
  apiRequestMethod: number | string; // 请求格式
  apiRequestTimeout: number; //超时时间

  apiSource?: string; //接口来源
  // 详情、新增、编辑使用的list
  bodyList?: addingApiParamterConfig[];
  paramList?: addingApiParamterConfig[];
  resultList?: addingApiParamterConfig[];
  // 编辑传递的字段
  apiCode?: string;
  apiStatus?: number;
  // 新增、编辑返回到后端的大数组（将三个list合并）
  createOrUpdateApiParamterConfigurationList?: addingApiParamterConfig[];
};
// 接口测试传递参数
export type apiTest = {
  //GET 或 POST
  apiRequestMethod: number | string;
  //超时时间
  apiRequestTimeout: number;
  //body参数发json字符串
  bodyParameters: string;
  //query或header参数,确认位置拼接，主要·顺序
  inputParams: addingApiParamterConfig[];
  url: string;
};
